package map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        map.put("语文", 95);
        map.put("数学", 99);
        map.put("英语", 65);
        map.put("物理", 75);
        map.put("化学", 85);
        map.put("历史", 95);
        System.out.println(map);

        Set<String> keySet = map.keySet();
        System.out.println(keySet);
        System.out.println("===================");
        for (String key :
                keySet) {
            System.out.println(key);
        }
        System.out.println("-------------------------");
        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
        System.out.println("888888888888");
        for (Map.Entry<String, Integer> e :
                entrySet) {

            System.out.println(e);

            // String key = e.getKey();
           // Integer value = e.getValue();
           // System.out.println(key + ":" + value);
        }
        System.out.println("888888888888");

        System.out.println("===================");
        Collection<Integer> values = map.values();
        System.out.println(values);

        for (Integer value :
                values) {
            System.out.println("value:"+value);

        }
        System.out.println("oooooooooooooooooooooooooooooooo");


        map.forEach((k,v) -> System.out.println(k+":"+v));





    }
}
